import actions from './actions'
import mutations from './mutations'
import defaultAvatar from '../../../assets/order/intall_no.png'
const state = {
	orders: [],
	total: 0,
	params: {
		type: 'all',
		page: 1,
		start_time: null,
		end_time: null,
		customer_service_id: null,
		facilitator_id: null,
		company_id: null,
		q:null
	},
	masters: [],
	companies: [],
	materials: [],
	order: {},
	audit_users: [],
	auitList: [],
	orderTitleList: [
		{ id: 'role1', dot: false, name: '全部订单', type:'all'},
		{ id: 'role2', dot: false, name: '审核节点', type:'p_audit' },
		{ id: 'role3', dot: false, name: '确认节点', type:'p_confirm'},
		{ id: 'role4', dot: false, name: '待接单',   type:'p_new' },
		{ id: 'role5', dot: false, name: '待测量',   type:'p_measure' },
		{ id: 'role6', dot: false, name: '待审核',   type:'p_audit'},
		{ id: 'role7', dot: false, name: '待运输',   type:'p_ship'},
		{ id: 'role8', dot: false, name: '待安装',   type:'p_install'},
		{ id: 'role9', dot: false, name: '待确认',   type:'p_confirm'},
		{ id: 'role10', dot: false, name: '已完成',  type:'p_completed'},
		{ id: 'role11', dot: false, name: '异常订单',type:'p_reject'},
		{ id: 'role12', dot: false, name: '回收站',  type:'p_trash'}
	],
	roles: {
		'super': [0, 3, 4, 5, 6, 7, 8, 9, 10, 11],
		'server': [0, 3, 4, 5, 6, 7, 8, 9,10 ,11],
		'finance': [2, 0, 3, 4, 5, 6, 7, 8, 9,10],
		'manager': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10],
		'tech': [0, 1, 3, 4, 5, 6, 7, 8, 9,10],
		'business': [0, 1, 3, 4, 5, 6, 7, 8, 9,10]
	},
	
	order_tab:[]
}

const getters = {
	orders: state => state.orders,
	params: state => state.params,
	masters: state => state.masters,
	companies: state => state.companies,
	total: state => state.total,
	order: state => state.order,
	customer_info: state => state.order.customer_info,
	customer_service_info: state => state.order.customer_service_info,
	service_info: state => state.order.service_info,
	materials: state => state.materials,
	order_tab: state => state.order_tab,
	// priceImgUrl: state => state.order.price_pictures.image.url,
	audit_users: state => state.audit_users
}

const orders = {
	namespaced: true,
	state: state,
	getters: getters,
	actions: actions,
	mutations: mutations
}

if(module.hot) {
	module.hot.accept(['./actions', './mutations'], () => {
		orders.hotUpdate({
			mutations: require('./mutations').default,
			actions: require('./actions').default
		})
	})
}

export default orders